package com.google.gwt.livinglife.client;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.google.gwt.livinglife.client.data.*;


@RemoteServiceRelativePath("livinglife")
public interface LivingLifeService extends RemoteService {
  // Each of the following add* methods return the datastore long key for the corresponding
	// object.
	public Long addChallenge(ChallengeData challenge) throws NotLoggedInException;
	
  public Long addResponse(ResponseData response) throws NotLoggedInException;
  public Long addComment(CommentData comment) throws NotLoggedInException;
  public Long addGroup(LivingLifeGroupData group_data, UserIdData founder) throws NotLoggedInException;
  public void deleteGroup(Long group_id) throws NotLoggedInException;
  public void updateUserData(LivingLifeUserData user_data) throws NotLoggedInException;
  
  public void addUserToGroup(String user_id, Long group_id)  throws NotLoggedInException;
  public void removeUserFromGroup(String user_id, Long group_id) throws NotLoggedInException;
  
  // Increment counters and return the current value of count for them.
  public int likeStory(Long story_id)  throws NotLoggedInException;
  public int inspiredBy(Long story_id)  throws NotLoggedInException;
  public int inappropriateStory(Long story_id) throws NotLoggedInException;

  // Query for Challenges using a selector object
  public ChallengeData[] getChallenges(ChallengeSelector selector);
  
  // Request additional responses for a given challenge
  public ResponseData[] getAdditionalResponses(AdditionalPostSelector selector);
  
  // Request additional comments for a given challenge or a given response  
  public CommentData[] getAdditionalComments(AdditionalPostSelector selector);
  
  // Request individual objects
  public LivingLifeGroupData getGroupById(Long id) throws ObjectNotFoundException;
  
  public LivingLifeGroupData getGroupByName(String groupName) throws ObjectNotFoundException;
  
  public LivingLifeGroupData[] getTopGroups(GroupSelector selector);
  
  public LivingLifeUserData getUserById(String id) throws ObjectNotFoundException;
  
  public LivingLifeUserData[] getUserByNickname(String name);
  
  public LivingLifeUserData[] getUserByEmail(String email);
  
  public ChallengeData getChallengeById(Long Challenge) throws ObjectNotFoundException;
  
  // public void sendEmailInvitation(LivingLifeGroupData group, String emails[]);
  
}
